package el.util.force;

import java.util.concurrent.Callable;

import prefuse.util.force.ForceItem;

public class WholeNBodyForceRunnable extends WholeNBodyForce implements Callable<Integer>{
	int id, cores;	
	public WholeNBodyForceRunnable(int id, int cores) {
		super();
		this.id = id;
		this.cores = cores;
	}
	@Override
	public Integer call() {
		int start = 0;
		for (ForceItem iitem : fi){
			if (start % this.cores == id){
		        try {
		            forceHelper(iitem,root,xMin,yMin,xMax,yMax);
		        } catch ( StackOverflowError e ) {
		            // TODO: safe to remove?
		            e.printStackTrace();
		        }
			}
			start ++;
    	}
		return 3;
	}

}
